Conversation
...c/Amazon.Lambda.Annotations.SourceGenerator/Amazon.Lambda.Annotations.SourceGenerator.csproj
Outdated
Show resolved
Hide resolved
normj
left a comment
There was a problem hiding this comment.
Curious about your thoughts. Right now the Authorizer attribute on the API function has to match the .NET method name. If the user sets the optional ResourceName on the LambdaFunction attribute on the authorizer function would it make sense that that is what the Authorizer should be set to?
[LambdaFunction]
[RestApi(LambdaHttpMethod.Get, "/secret", Authorizer = "MyAuthorizer")]
public IHttpResult GetRestricted(ILambdaContext context)
{
return HttpResults.Ok("You access the restricted section");
}
[LambdaFunction(ResourceName = "MyAuthorizer")]
[RestApiAuthorizer]
public IAuthorizerResult Authorize([FromServices] IAuthorizationService auth, [FromHeader] string authorization, ILambdaContext context)|
|
||
| /// <summary> | ||
| /// Name of the HTTP API Lambda authorizer to protect this endpoint. | ||
| /// Must match the Name property of an <see cref="HttpApiAuthorizerAttribute"/> in this project. |
There was a problem hiding this comment.
The docs are out of date when we used to have a Name property. The doc should be updated to be clear this needs to be the name of the .NET method that will be the authorizer and recommend using the nameof operator.
|
|
||
| /// <summary> | ||
| /// Name of the REST API Lambda authorizer to protect this endpoint. | ||
| /// Must match the Name property of a <see cref="RestApiAuthorizerAttribute"/> in this project. |
There was a problem hiding this comment.
The docs are out of date when we used to have a Name property. The doc should be updated to be clear this needs to be the name of the .NET method that will be the authorizer and recommend using the nameof operator.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.